<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  /*贾志磊*/
  class Stack {
    constructor() {
      this.stack = [];
    }

    push(x) {
      this.stack.push(x)
    }

    remove() {
      this.stack.pop();//先进后出 后进先出
    }
  }

  let stack = new Stack();
  stack.push(1);
  stack.push(2);
  console.log(stack);
  stack.remove();
  console.log(stack)
</script>
</body>
</html>
